/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model;

import java.io.Serializable;
import java.util.List;

import controll.Mapping;

/**
 *
 * @author phuc
 */
public class Toa implements Serializable {
    private static final long serialVersionUID = 1L;
    private Long toaID;
    private String tenToa;
    private List<Tau> tauList;
    private List<Ghe> gheList;
    private Mapping map  = null;

    public Toa() {
    }

    public Toa(Long toaID) {
        this.toaID = toaID;
    }

    public Toa(Long toaID, String tenToa) {
        this.toaID = toaID;
        this.tenToa = tenToa;
    }

    public Long getToaID() {
        return toaID;
    }

    public void setToaID(Long toaID) {
        this.toaID = toaID;
    }

    public String getTenToa() {
        return tenToa;
    }

    public void setTenToa(String tenToa) {
        this.tenToa = tenToa;
    }

    public List<Tau> getTauList() {
    	map = new Mapping();
    	return map.getTauList(this);
    }

    public List<Ghe> getGheList() {
    	map = new Mapping();
    	return map.getGheList(this);
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (toaID != null ? toaID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Toa)) {
            return false;
        }
        Toa other = (Toa) object;
        if ((this.toaID == null && other.toaID != null) || (this.toaID != null && !this.toaID.equals(other.toaID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entity.Toa[ toaID=" + toaID + " ]";
    }

	public Toa getToaByToaID(long toaID) {
		return map.getToaByToaID(toaID) ;
	}
    
}
